import { stringify } from 'qs';
import request from '@/utils/request';
import { getPageSize } from '@/utils/common';

// 油卡充值
export async function rechange(params) {
  return request(
    `/server/api/tms/tms-oil-card-change/oilCardRecharge`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

export async function selectList(params) {
  params.pageSize = params.pageSize || getPageSize();
  return request(`/server/api/tms/tms-oil-card/selectList`, {
    method: 'POST',
    body: params,
  });
}
export async function selectDetails(params) {
  return request(`/server/api/tms/tms-oil-card/viewDetails`, {
    method: 'POST',
    body: params,
  });
}
/**
 * 新增编辑
 */
export async function oilCardOperate(params) {
  const url = params.id ? 'tms-oil-card/upadteTmsOilCard' : 'tms-oil-card/insertTmsOilCard';

  return request(
    `/server/api/tms/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
//启用禁用
export async function ableOilCardOperate(params) {
  const url = params.type ? 'tms-oil-card/enableTmsOilCard' : 'tms-oil-card/disabledTmsOilCard';
  return request(
    `/server/api/tms/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
//删除油卡
export async function deleteOilCard(params) {
  return request(
    `/server/api/tms/tms-oil-card/deleteTmsOilCard`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
//主卡号--油卡号：
export async function selectMasterCardList(params) {
  return request(
    `/server/api/tms/tms-oil-card/selectMasterCardList`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
